//
//  YXMineAddressCell.m
//  CreditCard
//
//  Created by 杨旭 on 2017/12/24.
//  Copyright © 2017年 杨旭. All rights reserved.
//

#import "YXMineAddressCell.h"
#import "YXAddressModel.h"

@interface YXMineAddressCell ()

@end

@implementation YXMineAddressCell

#pragma mark - 点击设置默认地址
- (IBAction)selectBtnAction:(UIButton *)sender {
    sender.selected = !sender.selected;
    if (self.clickDefaultBtnBlock) {
        self.clickDefaultBtnBlock(self.model,sender);
    }
}
#pragma mark - 点击编辑
- (IBAction)editBtnAction:(UIButton *)sender {
    if (self.clickEditBtnBlock) {
        self.clickEditBtnBlock(self.model);
    }
}
#pragma mark - 点击删除
- (IBAction)deleteBtnAction:(UIButton *)sender {
    if (self.clickDeletedBtnBlock) {
        self.clickDeletedBtnBlock(self.model);
    }
    
}


- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}
- (void)setModel:(YXAddressModel *)model {
    _model = model;
    
    _nameLab.text = _model.addresseeName;
    _phoneLab.text = _model.phone;
    _addressLab.text = [NSString stringWithFormat:@"%@%@%@%@",_model.provinceName,_model.cityName,_model.areaName,_model.detailedAddress];
    if ([model.defaults isEqualToString:@"1"]) {
        self.selectBtn.selected = YES;
    }else {
        self.selectBtn.selected = NO;
    }
    NSLog(@"%@",model.defaults);
    

}
@end
